package org.at.strategy;

import java.util.HashMap;
import java.util.Map;

public class FullReductionStrategyFactory {
    private static final Map<String, FullReductionStrategy> STRATEGY_MAP = new HashMap<>();

    static {
        registerStrategy(new Full100Reduce10Strategy());
        registerStrategy(new NoDiscountStrategy());
    }

    // 注册策略接口
    private static void registerStrategy(FullReductionStrategy fullReductionStrategy) {
        STRATEGY_MAP.put(fullReductionStrategy.getCode(), fullReductionStrategy);
    }

    // 根据代码获取策略
    public static FullReductionStrategy getStrategy(String code) {
        return STRATEGY_MAP.get(code);
    }
}
